package com.javasvip.serviceemail.controller;

import com.javasvip.serviceemail.service.TolenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试
 */
@RestController
@RequestMapping("/token")
public class TokenController {
    @Autowired
    TolenService tolenService;

    @Autowired
    private JavaMailSender mailSender;

    @GetMapping("/openstate/{userId}")
    public Integer findDefaultResumeState(@PathVariable Long userId) {
        tolenService.fToken(1l);
        tolenService.ff();
        return 1;
    }

    @GetMapping("/main/{userId}")
    public Integer main(@PathVariable Long userId) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom("jr-zywqd01@jybdshop.cn");
        message.setTo("903950191@qq.com");
        message.setSubject("主题：简单邮件");
        message.setText("测试邮件内容");

        mailSender.send(message);
        return 1;
    }




}
